import 'package:flutter/material.dart';

main() => runApp(MyApp());

/* 
* Widget
* 有状态的Widget：StatefulWidget 运行中有一些状态（data）需要改变
* 无状态的Widget: StatelessWidget 内容是确定的，没有数据的改变
 */
class MyApp extends StatelessWidget {
  // build
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        // Scaffold 脚手架
        debugShowCheckedModeBanner: false,
        home: GLHomePage());
  }
}

class GLHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('首页'),
        ),
        body: GLContentBody());
  }
}

// @immutable 类 不可变
class GLContentBody extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Row(
        // 主轴对齐方式
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Checkbox(value: true, onChanged: (value) => print(value)),
          Text("Hello Flutter")
        ],
      ),
    );
  }
}
